package com.ruoyi.ymapp.user.utils;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @author Lu.F
 * @version 1.0
 * @date 2022/11/8 22:09
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class JsonData {

    /**
     * 响应码
     */
    private int code;

    /**
     * 响应数据
     */
    private Object data;

    /**
     * 提示信息
     */
    private String msg;

    public static JsonData buildSuccess(Object data){
        return new JsonData(0,data,null);
    }

    public static JsonData buildError(String msg){
        return new JsonData(-1,null,msg);
    }
}
